import request from '@/utils/request'
import FlowBox from '@/views/workFlow/components/FlowBox'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import { getGoodsSelector } from '@/api/services/goods'
export default {
  components: { FlowBox },
  props: [],
  data() {
    return {
      loading: false,
      visible: false,
      flowVisible: false,
      list: [],
      methodOptions: [{ fullName: '刷卡', id: '1' }, { fullName: '转账', id: '2' }, { fullName: '扫码', id: '3' }, { fullName: '现金', id: '4' }]
    }
  },
  computed: {},
  watch: {},
  created() {
    /*this.$store.dispatch('base/getDictionaryData', { sort: 'sex' }).then(res => {
      this.genderOptions = res
    });
    this.$store.dispatch("base/getDictionaryData", { sort: "Brand" }).then((res) => {
      this.brandOptions = res;
    });*/
  },
  mounted() {},
  methods: {
    goBack() {
      this.$emit('refresh')
    },

    init(id) {
      this.visible = true
      this.loading = true
      this.list = []
      request({
        url: `/api/crm/orders/${id}/payments`,
        method: 'get'
      })
        .then(res => {
          console.log(res)
          this.list = res.data
          this.loading = false
        })
        .catch(() => {
          this.loading = false
        })
    },
    addOrUpdateHandle(row, flowState) {
      let data = {
        id: row ? row.id : '',
        enCode: '#visualDevorderpayment',
        flowId: '625865114699957509',
        formType: 1,
        opType: flowState ? 0 : '-1',
        status: flowState,
        paymentId: row ? row.id : ''
      }
      this.flowVisible = true
      this.$nextTick(() => {
        this.$refs.FlowBox.init(data)
      })
    },

    colseFlow(isrRefresh) {
      this.flowVisible = false
    }
  }
}
